import Vue from 'vue'
import VueRouter from 'vue-router'
// 导入图片列表组件
import Lists from '@/components/photo/List.vue'
// 导入图片详情组件
import Info from '@/components/photo/Info.vue'
import shopcar from '@/components/shopcar/Shopcar.vue'

// 导入路由文件
import Home from '@/components/Home.vue'
import List from '@/components/goods/List.vue'
import GoodsDetails from '@/components/goods/GoodsDetails.vue'
import GoodsDesc from '@/components/goods/GoodsDesc.vue'
import GoodsComments from '@/components/goods/GoodsComments.vue'
import Welcome from '@/components/Welcome/Welcome.vue'
import Member from '@/components/Welcome/Member.vue'

import newsList from '@/components/news/List.vue'
import Detail from '@/components/news/Detail.vue'
// 导入Search组件
import Search from '@/components/tabbar/Search.vue'
// 导入AddGood组件
import AddGood from '@/components/goods/Add.vue'

Vue.use(VueRouter)

// 路由配置规则
const routes = [{
  path: '/',
  redirect: '/welcome'
}, {
  path: '/home',
  component: Home,
  children: [{
    path: '/goods/list',
    component: List
  }, {
    path: '/api/goods/getdesc/:id',
    component: GoodsDetails
  }, {
    path: '/goodsdesc/:id',
    component: GoodsDesc
  }, {
    path: '/goodscomments/:id',
    component: GoodsComments
  }, {
    path: '/welcome',
    component: Welcome
  },
  {
    path: '/member',
    component: Member
  },
  {
    path: '/newslist',
    component: newsList
  }, {
    path: '/detail/:id',
    component: Detail
  }, {
    path: '/photo/list',
    component: Lists
  }, {
    path: '/photo/info/:id',
    component: Info
  },
  {
    path: '/search',
    component: Search
  }, {
    path: '/addgoods',
    component: AddGood
  }, {
    path: '/shopcar',
    component: shopcar
  }
  ]
}]

const router = new VueRouter({
  routes
})
// 导出路由
export default router
